package cn.edu.scau.cmi.dengzejun.chapter09;

import java.util.*;

public class Example9_20 {
	public static void main(String args[]) {
		String cost = " TV cost 876 dollar . Computer cost 2398 dollar . Telephone cost 1278 dollar.";
		Scanner scanner = new Scanner(cost);
		double sum = 0;
		while (scanner.hasNext()) {
			try {
				double price = scanner.nextDouble();
				sum +=price;
				System.out.println(price);
			}catch (InputMismatchException e) {
				String t = scanner.next();
			}
		}
		System.out.println("the total is "+sum);
		return;
	}
}
